home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _B2469B190BCE482EB2C55FDB2539CC8E < prev    next >
Encoding:
Text File  |  2002-06-19  |  8.9 KB  |  365 lines

  1. // Copyright (C) 2001-2002 Raven Software
  2. //
  3. // bg_weapons.h - weapons data loading
  4.  
  5. #ifndef __BG_WEAPONS_H__
  6. #define __BG_WEAPONS_H__
  7.  
  8. // means of death
  9. typedef enum 
  10. {
  11.     MOD_UNKNOWN,
  12.  
  13.     // Knife
  14.     MOD_KNIFE,
  15.  
  16.     // Pistols
  17.     MOD_M1911A1_PISTOL,
  18.     MOD_USSOCOM_PISTOL,         
  19.  
  20.     // Secondarys
  21.     MOD_M590_SHOTGUN,
  22.     MOD_MICRO_UZI_SUBMACHINEGUN, 
  23.     MOD_M3A1_SUBMACHINEGUN,      
  24.     MOD_MP5,
  25.  
  26.     // Primaries
  27.     MOD_USAS_12_SHOTGUN,         
  28.     MOD_M4_ASSAULT_RIFLE,        
  29.     MOD_AK74_ASSAULT_RIFLE,      
  30.     MOD_MSG90A1_SNIPER_RIFLE,    
  31.     MOD_M60_MACHINEGUN,          
  32.     MOD_MM1_GRENADE_LAUNCHER,    
  33.     MOD_RPG7_LAUNCHER,           
  34.  
  35.     // Grenades
  36.     MOD_M84_GRENADE,
  37.     MOD_SMOHG92_GRENADE,
  38.     MOD_ANM14_GRENADE,
  39.     MOD_M15_GRENADE,
  40.  
  41.     MOD_WATER,
  42.     MOD_CRUSH,
  43.     MOD_TELEFRAG,
  44.     MOD_FALLING,
  45.     MOD_SUICIDE,
  46.     MOD_TEAMCHANGE,
  47.     MOD_TARGET_LASER,
  48.     MOD_TRIGGER_HURT,
  49.     MOD_TRIGGER_HURT_NOSUICIDE
  50.  
  51. } meansOfDeath_t;
  52.  
  53. typedef enum 
  54. {
  55.     WP_NONE,
  56.  
  57.     // Knife
  58.     WP_KNIFE,
  59.  
  60.     // Pistols
  61.     WP_M1911A1_PISTOL,
  62.     WP_USSOCOM_PISTOL,
  63.  
  64.     // Secondarys
  65.     WP_M590_SHOTGUN,
  66.     WP_MICRO_UZI_SUBMACHINEGUN,
  67.     WP_M3A1_SUBMACHINEGUN,
  68.     WP_MP5,
  69.  
  70.     // Primaries
  71.     WP_USAS_12_SHOTGUN,
  72.     WP_M4_ASSAULT_RIFLE,
  73.     WP_AK74_ASSAULT_RIFLE,
  74.     WP_MSG90A1,
  75.     WP_M60_MACHINEGUN,
  76.     WP_MM1_GRENADE_LAUNCHER,
  77.     WP_RPG7_LAUNCHER,
  78.  
  79.     // Grenades
  80.     WP_M84_GRENADE,
  81.     WP_SMOHG92_GRENADE,
  82.     WP_ANM14_GRENADE,
  83.     WP_M15_GRENADE,
  84.  
  85.     WP_NUM_WEAPONS
  86. } weapon_t;
  87.  
  88. #define WP_DELAYED_CHANGE_BIT    (1<<5)
  89.                 
  90. typedef enum 
  91. {                            
  92.     AMMO_KNIFE,
  93.     AMMO_045,
  94.     AMMO_556,
  95.     AMMO_9,
  96.     AMMO_12 ,
  97.     AMMO_762,
  98.     AMMO_40,
  99.     AMMO_RPG7,
  100.     AMMO_M15,
  101.     AMMO_M84,
  102.     AMMO_SMOHG92,
  103.     AMMO_ANM14,
  104.  
  105.     AMMO_762_BELT,
  106.  
  107.     AMMO_MP5_9,
  108.  
  109.     AMMO_MAX,
  110.  
  111.     AMMO_NONE,
  112.  
  113. } ammo_t;
  114.  
  115. #define WP_FIREMODE_NONE        0
  116. #define WP_FIREMODE_AUTO        1
  117. #define WP_FIREMODE_BURST        2
  118. #define WP_FIREMODE_SINGLE        3
  119. #define WP_FIREMODE_MAX            4
  120.  
  121. #define PROJECTILE_FIRE            0x0010    // projectile NOT bullet
  122. #define PROJECTILE_TIMED        0x0020    // projectile ONLY explodes after time is up
  123. #define PROJECTILE_GRAVITY        0x0040    // projectile obeys gravity
  124. #define PROJECTILE_DAMAGE_AREA    0x0080 // projectile does area damage over time
  125. #define UNLOCK_MUZZLEFLASH        0x0100    // muzzle flash is locked to muzzle bolt by default
  126. #define    PROJECTILE_LIGHTGRAVITY    0x0200    // projectile has light gravity
  127.  
  128. typedef enum
  129. {
  130.     CAT_NONE = 0,
  131.     CAT_KNIFE,
  132.     CAT_PISTOL,
  133.     CAT_SHOTGUN,
  134.     CAT_SUB,
  135.     CAT_ASSAULT,
  136.     CAT_SNIPER,
  137.     CAT_HEAVY,
  138.     CAT_GRENADE,
  139.     CAT_MAX
  140.  
  141. } ECategory;
  142.  
  143. typedef struct attackData_s
  144. {
  145.     char            name[MAX_QPATH];
  146.     char            icon[MAX_QPATH];
  147.  
  148.     const char*        melee;
  149.  
  150.     meansOfDeath_t    mod;                        // means of death
  151.     int                ammoIndex;                    // Index to proper ammo slot
  152.     union 
  153.     {
  154.         int        range;                            // Range of weapon 
  155.         int        velocity;                        // speed of projectile
  156.     } rV;
  157.  
  158.     int            clipSize;                        // how large is a clip
  159.     int            fireAmount;                        // how much ammo to use per shot
  160.     int            fireFromClip;                    // 0 = fire from approp. ammo pool, 1 = fire from clip
  161.     int            damage;                            // how much damage is done per hit
  162.     float        inaccuracy;                        // how inaccurate is weapon
  163.     float        maxInaccuracy;                    // maximum lvl of inaccuracy
  164.     int            pellets;                        // how many individual 'bullets' are shot with one trigger pull?
  165.     int            weaponFlags;                    // which fire modes are available, projectiles timed or impact, .etc
  166.     int            projectileLifetime;                // how long does projectile live (before exploding)
  167.     int            splashRadius;                    // how large is splash damage radius
  168.     int            fireDelay;                        // Extra delay when firing
  169.     qboolean    gore;                            // is gore enabled for this attack?
  170.     int            extraClips;                        // Extra clips you get when starting
  171.     float        bounceScale;                    // how much something bounces
  172.  
  173.     vec3_t        minKickAngles;
  174.     vec3_t        maxKickAngles;
  175.  
  176.     // Names of effects, sounds, models, bones
  177.     char        muzzleEffect[MAX_QPATH];
  178.     char        muzzleEffectBone[MAX_QPATH];
  179.     char        muzzleEffectInWorld[MAX_QPATH];
  180.     char        tracerEffect[MAX_QPATH];
  181.     char        ejectBone[MAX_QPATH];
  182.     char        shellEject[MAX_QPATH];
  183.     char        explosionSound[MAX_QPATH];
  184.     char        explosionEffect[MAX_QPATH];
  185.     char        missileG2Model[MAX_QPATH];
  186.  
  187.     int            animFire;
  188.     int            animFireZoomed;
  189.  
  190. } attackData_t;
  191.  
  192. typedef struct weaponData_s
  193. {
  194.     char            *classname;                    // Spawning name
  195.     ECategory        category;                    // what group of weapons is this one part of?
  196.     qboolean        safe;
  197.     char            worldModel[MAX_QPATH];        // world model
  198.     char            menuImage[MAX_QPATH];        // names of the icon files
  199.  
  200.     int                animDrop;
  201.     int                animRaise;
  202.     int                animIdle;
  203.     int                animIdleZoomed;
  204.     int                animReload;
  205.     int                animReloadStart;
  206.     int                animReloadEnd;
  207.  
  208.     attackData_t    attack[ATTACK_MAX];
  209.  
  210.  
  211. } weaponData_t;
  212.  
  213. typedef struct  ammoData_s
  214. {
  215.     char    *name;                // name of ammo
  216.     char    icon[32];            // Name of ammo icon file
  217.     int        max;                // Max amount player can hold of ammo
  218.     float    goreScale;
  219.  
  220. } ammoData_t;
  221.  
  222. extern char *weaponNames[WP_NUM_WEAPONS];
  223. extern weaponData_t weaponData[WP_NUM_WEAPONS];
  224. extern char *ammoNames[AMMO_MAX];
  225. extern ammoData_t ammoData[AMMO_MAX];
  226.  
  227. // Specific weapon information
  228.  
  229. #define WP_FIRST_RANGED_WEAPON        WP_M1911A1_PISTOL    // this is the first weapon for next and prev weapon switching
  230. #define WP_FIRST_MELEE_WEAPON        WP_KNIFE
  231. #define MAX_PLAYER_WEAPONS            (WP_NUM_WEAPONS-1)    // this is the max you can switch to and get with the give all.
  232.  
  233. #define    MAX_WEAPON_SOUNDS        12
  234. #define    MAX_WEAPON_SOUND_SLOTS    3
  235.  
  236. #define MAX_SIDE_SURFACES 16
  237.  
  238. typedef struct SOptionalWeapon
  239. {
  240.     char                    mName[MAX_QPATH];
  241.     char                    mMuzzle[MAX_QPATH];
  242.     char                    *mSurfaces[MAX_SIDE_SURFACES];
  243.  
  244.     struct SOptionalWeapon    *mNext;
  245. } TOptionalWeapon;
  246.  
  247. typedef struct SBoltonWeapon
  248. {
  249.     char                mName[MAX_QPATH];
  250.     char                mModel[MAX_QPATH];
  251.     char                mParent[MAX_QPATH];
  252.     char                mBoltToBone[MAX_QPATH];
  253.     char                *mRightSide[MAX_SIDE_SURFACES];
  254.  
  255.     char                mJointBone[MAX_QPATH];
  256.     char                mJointParentBone[MAX_QPATH];
  257.     char                mJointForward[10];
  258.     char                mJointRight[10];
  259.     char                mJointUp[10];
  260. } TBoltonWeapon;
  261.  
  262. typedef struct SNoteTrack
  263. {
  264.     char                    mNote[64];
  265.     int                        mFrame;
  266.  
  267.     struct SNoteTrack        *mNext;
  268. } TNoteTrack;
  269.  
  270. #define    MAX_WEAPON_ANIM_CHOICES        4
  271.  
  272. typedef struct SAnimInfoWeapon
  273. {
  274.     char                    mName[MAX_QPATH];
  275.     char                    mType[MAX_QPATH];
  276.     char                    *mAnim[MAX_WEAPON_ANIM_CHOICES];
  277.     char                    *mTransition[MAX_WEAPON_ANIM_CHOICES];
  278.     char                    *mEnd[MAX_WEAPON_ANIM_CHOICES];
  279.     float                    mSpeed;
  280.     int                        mLODBias;
  281.     int                        mNumChoices;
  282.                             
  283.     int                        mStartFrame[MAX_WEAPON_ANIM_CHOICES];
  284.     int                        mNumFrames[MAX_WEAPON_ANIM_CHOICES];
  285.     int                        mFPS[MAX_WEAPON_ANIM_CHOICES];
  286.  
  287.     struct SNoteTrack        *mNoteTracks[MAX_WEAPON_ANIM_CHOICES];
  288.     struct SAnimInfoWeapon    *mNext;
  289. } TAnimInfoWeapon;
  290.  
  291. typedef struct SAnimWeapon
  292. {
  293.     char                    mName[MAX_QPATH];
  294.     char                    mMuzzle[MAX_QPATH];
  295.  
  296.     struct SAnimInfoWeapon    *mInfos;
  297.     struct SAnimInfoWeapon    *mWeaponModelInfo;        // "weaponmodel" info
  298.     struct SAnimWeapon        *mNext;
  299.  
  300. } TAnimWeapon;
  301.  
  302. typedef struct SWeaponModel
  303. {
  304.     char                        mName[MAX_QPATH];
  305.     char                        mModel[MAX_QPATH];
  306.     char                        mBufferName[MAX_QPATH];
  307.     char                        mBufferModel[MAX_QPATH];
  308.     char                        mBufferBoltToBone[MAX_QPATH];
  309.     char                        mBufferMuzzle[MAX_QPATH];
  310.     char                        mBufferAltMuzzle[MAX_QPATH];
  311.     char                        mLeftHandsBoltToBone[MAX_QPATH];
  312.     char                        mRightHandsBoltToBone[MAX_QPATH];
  313.     char                        *mFrontSurfaces[MAX_SIDE_SURFACES],
  314.                                 *mRightSideSurfaces[MAX_SIDE_SURFACES],
  315.                                 *mLeftSideSurfaces[MAX_SIDE_SURFACES];
  316.  
  317.     struct SOptionalWeapon        *mOptionalList;
  318.     struct SBoltonWeapon        *mBolton;
  319. } TWeaponModel;
  320.  
  321. #define MAX_CALLBACK_SURFACES    4
  322.  
  323. typedef struct SOnOffSurface
  324. {
  325.     char    mName[64];
  326.     int        mStatus;
  327. } TOnOffSurface;
  328.  
  329. typedef struct SSurfaceCallback
  330. {
  331.     char                    mName[64];
  332.     struct SOnOffSurface    mOnOffSurfaces[MAX_CALLBACK_SURFACES];
  333. } TSurfaceCallback;
  334.  
  335. #define MAX_SURFACE_CALLBACKS    2
  336.  
  337. typedef struct SWeaponInfo
  338. {
  339.     char                        *mName;
  340.     float                        mForeshorten;
  341.     vec3_t                        mViewOffset;
  342.     char                        mSoundNames[MAX_WEAPON_SOUNDS][MAX_QPATH];
  343.     char                        mSounds[MAX_WEAPON_SOUNDS][MAX_WEAPON_SOUND_SLOTS][MAX_QPATH];
  344.     struct SSurfaceCallback        mSurfaceCallbacks[MAX_SURFACE_CALLBACKS];
  345.     struct SAnimWeapon            *mAnimList;
  346.     struct SWeaponModel            mWeaponModel;
  347. } TWeaponParseInfo;
  348.  
  349. extern TWeaponParseInfo    weaponParseInfo[WP_NUM_WEAPONS];
  350. extern char                weaponLeftHand[MAX_QPATH];
  351. extern char                weaponRightHand[MAX_QPATH];
  352.  
  353. qboolean            BG_ParseInviewFile            ( qboolean );
  354. TAnimWeapon*        BG_GetInviewAnim            ( int weaponIdx,const char *animKey,int *animIndex);
  355. TAnimWeapon*        BG_GetInviewAnimFromIndex    ( int weaponIdx,int animIndex);
  356. TAnimInfoWeapon*    BG_GetInviewModelAnim        ( int weaponIdx,const char *modelKey,const char *animKey);
  357. qboolean            BG_WeaponHasAlternateAmmo    ( int weapon );
  358. int                    BG_FindFireMode                ( weapon_t weapon, attackType_t attack, int firemode );
  359.  
  360. void                BG_CalculateBulletEndpoint    ( vec3_t muzzlePoint, vec3_t fireAngs, float inaccuracy, float range, vec3_t end, int *seed );
  361. int                    BG_GetMaxAmmo                ( const playerState_t* ps, int ammoIndex );
  362.  
  363. #endif
  364.  
  365.